package com.isay.frameworklib.utils;

import android.app.Application;
import android.content.Context;
import android.text.TextUtils;
import android.widget.Toast;

import com.isay.frameworklib.application.ApplicationUtils;


/**
 * Created by cywu4 on 2017/10/23.
 */

public class ToastUtils {

    private static Toast mToast;

    public static void show(String text) {
        if (mToast == null) {
            Application application = ApplicationUtils.getApplication();
            mToast = Toast.makeText(application, text, Toast.LENGTH_SHORT);
        }
        if (TextUtils.isEmpty(text)) {
            text = "...";
        }
        mToast.setText(text);
        mToast.show();
    }

    public static void cancel() {
        if (mToast != null) {
            mToast.cancel();
        }
    }


}
